package com.itcast.tanhuaserver.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itcast.tanhuaserver.domain.Announcement;
import com.itcast.tanhuaserver.mapper.AnnouncementMapper;
import com.itcast.tanhuaserver.service.AnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @PachageName: com.itcast.tanhuaserver.service.impl
 * @ClassName:
 * @Description: TODO
 * @Author: Hushi
 * @DateTime: 2021/2/2218:49
 * @Version 1.0
 */
@Service
public class AnnouncementServiceImpl implements AnnouncementService {

    @Autowired
    private AnnouncementMapper announcementMapper;
    @Override
    public IPage<Announcement> queryList(Integer page, Integer pageSize) {
        QueryWrapper<Announcement> query = new QueryWrapper<>();
        query.orderByDesc("created");
        return this.announcementMapper.selectPage(new Page<Announcement>(page,pageSize),query);
    }
}
